operator<<() method from fcf::NTest::TimeDuration class
Class:
Package: fcfTest
File: test.hpp
Available from version: 1.2.5
Inserts the duration into an output stream.
The std::cout.
It supports a special
Result
- Reference to the output stream.
Example: Stream insertion
Demonstrating how to print durations using the stream operator and the Friendly manipulator.
#define FCF_TEST_IMPLEMENTATION
#include <fcfTest/test.hpp>
#include <iostream>
FCF_TEST_DEFINE ("TimeDemo", "Basics", "StreamInsertion") {
fcf::NTest::TimeDuration d(1234567890ULL);
// 1. Standard output
std::cout << d << std::endl;
// 2. Friendly output using the Friendly manipulator
std::cout << fcf::NTest::Friendly (true) << d << std::endl;
// 3. Raw output using the Friendly manipulator
std::cout << fcf::NTest::Friendly (false) << d << std::endl;
}
int main(int a_argc, char* a_argv[]) {
bool error = false;
fcf::NTest::cmdRun (a_argc, a_argv, fcf::NTest::CRM_RUN , &error);
return error ? 1 : 0;
}
Output:
Performing the test: "TimeDemo" -> "Basics" -> "StreamInsertion" ...
1234567890
1.234`567`890
1.234567890
[SUCCESS] Test completed successfully (0.000`000`000 sec)
[SUCCESS] All tests were completed.
Tests: 1 passed, 0 failed, 0 skipped, 1 total
Duration: 0.000`000`000 sec
VPSDime is an industry leading VPS hosting company that provides virtualized server services with high performance, availability and friendly support.